<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>数据列表</title>
		<meta name="renderer" content="webkit">
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<style>
			@charset "UTF-8";
	
			body {
				margin: 10px 10px 10px 10px !important;
				background: #f2f2f2;
			}
			
			.page_container {
				border: 1px solid #f2f2f2;
				border-radius: 5px;
				background-color: #ffffff;
				padding: 20px;
			}
			
			.page_container .zhongxian {
				opacity: 0.15;
			}
			
			.page_container .atitle {
				margin-left: 20px;
				padding: 0 10px;
				font-size: 20px;
				font-weight: 300;
			}
			.layui-layer-dialog .layui-layer-setwin{
				display: none;
			}
			.row-edit{
				color: #fff!important;
				background-color: #009688!important;
			}
			
			.row-delete{
				color: #fff!important;
				background-color: #FF5722!important;
			}
		</style>
		<link rel="stylesheet" href="../utils/layui/css/layui.css">
		<!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
	</head>
	<body>
		<!-- 架子出来了 -->
		<div class="page_container"  id="view">
			
			<div class="layui-row" style="position: relative;">
				<div class="layui-col-xs6">
					<div class="grid-demo grid-demo-bg1">
						<a class="atitle" style="opacity: 0.6;"> <span class="zhongxian"></span>数据列表<span class="zhongxian"></span>
						</a>
						<div id="searchInfo" style="display: none;"><font style="border-radius: 25px;background: #f33;padding: 2px 35px;margin-left: 20px;color: #fff;">共计搜索到<b id="dataNum"></b>条数据 &nbsp;, &nbsp;<a style="color: #fff;" onclick="cleanSearch(this);" href="javascript:void(0)">清除搜索</a></font></div>
					</div>
					
				</div>
				
				<div class="layui-col-xs6" style="text-align: right; width: 100%; min-width: 450px; position: absolute; right: 0px;z-index: 9999999; display: none;">
					<div class="grid-demo" id="so-form" style="display: none;">
						<form name="" action="" method="">
							<select id="linesokey" class="layui-btn layui-btn-primary" style="display: inline-block; height: 38px; line-height: 38px; padding: 0 18px; font-size: 14px; max-width: 100px;">
								<option value="_id">_id</option>
								<option value="_source">_source</option>
							</select>
							<input id="linesoval" type="text" class="layui-btn layui-btn-primary" style="max-width: 100px;cursor:text;"
							 value="">
							<button type="button" class="layui-btn layui-btn-normal" onclick="lineSo(this)">搜索</button>
							<button style="display: none;" type="button" class="layui-btn layui-btn-warm"  onclick="advancedso(this);" id="advancedSearch">高级</button>
						</form>
					</div>
				</div>
				
			</div>
			
			<br />
			<table class="layui-hide" id="test" lay-filter="test" ></table>
			<script type="text/html" id="leftbarDemo">
				<i class="layui-icon" lay-event="spread" style="cursor:pointer;" >&#xe602;</i>  
			</script>
			<script type="text/html" id="toolbarDemo">
				<div class="layui-btn-container layui-btn-group">
					 <button class="layui-btn layui-btn-primary layui-btn-sm delete" lay-event="delete" data-href="" data-title="删除"><i class="layui-icon"></i>删除</button> 
				</div>
			</script>
			<script type="text/html" id="barDemo"> 
			  {{#  arr_foreach(d.row_toolbar, function(k1, v1){ }}
			  <a class="layui-btn layui-btn-primary layui-btn-xs  row-{{v1.event}}" lay-event="{{v1.event}}" data-href='{{v1.href}}' data-title="{{v1.title}}"><i class="layui-icon">{{v1.ico}}</i>{{v1.title}}</a>
			  {{#  }); }}
			</script>
			
			<div id="tx_div" style="position: absolute; top: 30%;width: 88%; height: auto; overflow: hidden; min-height: 300px;  background: #fff;border: 1px solid #009688; display: none;z-index: 999999;">
			    <div class="layui-tab layui-tab-card" style="margin:0px;border:none;box-shadow:none; position: relative;">
			      <div style="position: absolute;right:0px;z-index:99999;" onclick="detailsColse();"><i style="font-size: 30px;color: #f00;cursor:pointer" class="layui-icon layui-icon-close-fill"></i></div>
			      <ul class="layui-tab-title" id="detail-ul">
					  {{#  arr_foreach(d.detail, function(k1, v1){ }}
					  	<li onclick="ajaxDetail(this,'{{k1}}')">{{v1}}</li>
					  {{#  }); }}
			      </ul>
			      <div class="layui-tab-content" style="padding: 0px;">
			        <div class="layui-tab-item layui-show" id="finder-content" style="margin: 0px; padding:0px;"></div>
			      </div>
			    </div>
			</div>
			
		</div>
		<br /><br />
		<div style="text-align: center; background-color:#FFF; position: fixed; bottom: 0px; width: 100%;opacity: 0.8; padding-top: 8px; padding-bottom: 8px; display: none;" id="confirmSelect">
			<button type="button" class="layui-btn layui-btn-normal" onclick="confirmSelect(this);">确认所选</button>
			<button type="button" class="layui-btn layui-btn-warm" onclick="javascript:parent.layer.closeAll();">取消选择</button>
		
		</div>	
		<input type="hidden" id="menu-data" value='' />
	</body>
	<script src="/admin/utils/layui/layui.js" charset="utf-8"></script>
	<script src="/admin/utils/layui/config.js" charset="utf-8"></script>
	<script>
		layui.use(['view', 'finder'], function () {
			let view = layui.view;
			let finder = layui.finder;
			if($_GET['fun']){
				$("#confirmSelect").css("display", "");
			}
			if(getPageWidth() < 400){
				$("#advancedSearch").css("display", 'none');
			}
			
			var jsonData = '{"id":-1,"title":"question","icon":"fa fa-circle-o","api":"\/admin\/finder\/question","page":"\/admin\/page\/finder.html","target":"_self","parent_id":-1,"db_table":"","table_struct":{"field":{"_id":{"field":"_id","type":"varchar","null":"no","default":null,"label":"_id","search":false,"in_list":true,"in_field":true,"width":120,"input_maxlength":"60","input_type":"text"},"_index":{"field":"_index","type":"varchar","null":"no","default":null,"label":"_index","search":false,"in_list":true,"in_field":true,"width":120,"input_maxlength":"60","input_type":"text"},"_type":{"field":"_type","type":"varchar","null":"no","default":null,"label":"_type","search":false,"in_list":true,"in_field":true,"width":120,"input_maxlength":"60","input_type":"text"},"_score":{"field":"_score","type":"varchar","null":"no","default":null,"label":"_score","search":false,"in_list":true,"in_field":true,"width":120,"input_maxlength":"60","input_type":"text"},"_source":{"field":"_source","type":"varchar","null":"no","default":null,"label":"_source","search":false,"in_list":true,"in_field":true,"width":600,"input_maxlength":"500","input_type":"textarea"}},"primary_key":"_id","tree":[]},"stepform_fields":null,"head_toolbar":[{"event":"add","ico":"&#xe608;","title":"添加","href":""},{"event":"delete","ico":"&#xe640;","title":"删除","href":""}],"row_toolbar":[{"event":"edit","ico":"&#xe642;","title":"编辑","href":""},{"event":"delete","ico":"&#xe640;","title":"删除","href":""}],"operate_width":150,"custom_templist":null,"custom_tempadd":null,"custom_tempedit":null,"sortrank":50,"is_basics":0,"eshost":null,"href":"\/admin\/page\/finder.html?api=\/admin\/dbfinder\/meditation_author","detail":""}';
			$("#menu-data").val(jsonData);
			var jsonObj = eval('('+jsonData+')');
			window.memuData = jsonObj;//全局菜单数据
			finder.layuiTable($_GET['api'], 'test', jsonObj);//显示表格
			showSearchInfo();
		});		
		window.confirmSelect = function(obj){
			var checkStatus = table.checkStatus('test'); //idTest 即为基础参数 id 对应的值
			if(checkStatus.data.length == 0){
				return noticeMsg('error', '未选择任何数据');
			}
			parent.window.tempField = window.memuData.table_struct.field;
			if($_GET['fun'] != undefined && strrpos($_GET['fun'], 'one') >= 0){
				var myobj = checkStatus.data[0];
				parent.window.tempJson = myobj;
				eval('parent.window.' + $_GET['fun'] + '()');
			}else{
								
				parent.window.tempJson = [];
				parent.window.tempJson = checkStatus.data;
				eval('parent.window.' + $_GET['fun'] + '()');
			}
			
		}
	</script>
</html>
